package com.testdemo.web.shapejudge.impl;
 
 

public class LineJudgeQuestionImpl extends ShapeJudgeQuestionImpl  {

	int PointX1, PointY1;
	int PointX2, PointY2;
	int PointX3, PointY3;

	public LineJudgeQuestionImpl() {
		PointX1 = (int) (Math.random() * 10);
		PointY1 = (int) (Math.random() * 10);
		PointX2 = (int) (Math.random() * 10);
		PointY2 = (int) (Math.random() * 10);
		PointX3 = (int) (Math.random() * 10);
		PointY3 = (int) (Math.random() * 10);
		this.RightAnswer = Judge();
	}
	
	public LineJudgeQuestionImpl(int x1, int x2,int x3, int y1, int y2, int y3 ) {
		PointX1 = x1;
		PointY1 = y1;
		PointX2 = x2;
		PointY2 = y2;
		PointX3 = x3;
		PointY3 = y3;
		this.RightAnswer = Judge();
	}
	
	
	public boolean Judge(){
		double a = (PointY1 - PointY2)/(PointX1 - (double)PointX1);
		double b = PointY1 - a * PointX1;
		
		double tempY = a * PointX3 + b;
		if (tempY == (double)PointY3)
			return true;
		else
			return false;
	}

	@Override
	public String getQusitionString() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getRightAnswerString() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getAnsewerString() {
		// TODO Auto-generated method stub
		return null;
	}
}
